package com.example.springcloud.provider.student.controller;

import com.example.springcloud.common.entity.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/time")
@Slf4j
public class TimeoutController {
    @GetMapping("ok")
    public ResponseResult<?> getOk() {
        return new ResponseResult<>(200, "访问成功", "ok");
    }

    @GetMapping("out")
    public ResponseResult<?> getOut() {
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            log.info("sleep exception");
        }
        log.info("provider timeout");
        return new ResponseResult<>(200, "访问成功", "time out");
    }
}
